// Agent gatekeeper in project vacaloucaMASSim2010

/* Initial beliefs and rules */

/* Initial goals */

!explore.

/* Plans */

+!explore : not pos(_,_,_)
<- .print("explorer: waitin position...");
	.wait("+pos(_,_,_)");
	.print("explorer: got position...");
	!!explore.

+!explore : pos(X,Y,_) & actions.inside_corral(X,Y)
<- 		.print("explorer: To preso, open(fence)!");
		.broadcast(tell,open(fence));
		.print("explorer: Mandei broadcast open(fence)!");
		?fence(_,_,open);
		actions.debug_felipe("explorer: fence abriu! =D");
		!!explore.
		
+!explore : pos(X,Y,_) & actions.unknown_cell(X,Y,UX,UY)
	<- .print("explorer: explorando!...");
		actions.astar(X,Y,UX,UY,Direction);
		moveTo(Direction);
		!!explore.
